package com.xfcy.blog.controller.system;



import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.xfcy.blog.annotation.OperationLogger;
import com.xfcy.blog.common.R;
import com.xfcy.blog.entity.SystemConfig;
import com.xfcy.blog.service.SystemConfigService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 系统配置表(SystemConfig)表控制层
 *
 * @author 晓风残月Lx
 * @since 2023-04-09 11:03:06
 */
@RestController
@RequestMapping("system/config")
public class SystemConfigController {

    @Resource
    private SystemConfigService systemConfigService;

    @GetMapping("/getConfig")
    @SaCheckLogin
    @ApiOperation(value = "查询系统配置", httpMethod = "GET", response = R.class, notes = "查询系统配置")
    public R getConfig() {
        return systemConfigService.getConfig();
    }

    @OperationLogger(value = "修改系统配置")
    @RequestMapping(value = "/update",method = RequestMethod.POST)
    @SaCheckPermission("/system/config/update")
    @ApiOperation(value = "修改系统配置", httpMethod = "POST", response = R.class, notes = "修改系统配置")
    public R update(@RequestBody SystemConfig systemConfig) {
        return systemConfigService.updateConfig(systemConfig);
    }

}

